<template>
	<view>
		<view class="nav">
			 <u-tabs :list="list1" @click="click" :scrollable="false" 
			         :inactiveStyle="inactiveStyle" :activeStyle="activeStyle" :lineWidth="52"
					  :lineColor="color" :current="current"></u-tabs>
		</view>
		
		<view class="viewbox auto p-top120">
				
			<view class="list" v-for="(item,index) in pageData" :key="index" @click="Toanswer(item)">
				<image :src="$imgUrls(item.wx_img)" mode="aspectFill" class="list_top_img"></image>
				<view class="row f-column padding20-24">
					<view class="row a-center">
						<!-- <view class="tip flexac biStudy">
							<text class="tip_txt">{{item.wx_title}}</text>
						</view> -->
						<text class="flex-1 size26 color_33 bold ellipsis">{{item.wx_title}}</text>
					</view>
					
					<view class="row j-sb a-center">
						<text class="color_66 h7">共{{item.total_count}}题，每日{{item.day_count}}题</text>
						<view class="d-flex f-column">
							<text class="color_66 h7 schedule">总进度 {{item.percent}}%</text>
							<view class="progor m-top10">
								<view class="schPro" :style="{width:item.percent+'%'}"></view>
							</view>
						</view>
					</view>
					
					<text class="color_E6 h7" v-if="item.answer_type == 1">请在每日24时前完成答题</text>
					<text class="color_E6 h7" v-if="item.answer_type == 2">请在{{item.end_time}}前完成答题</text>
					<text class="color_E6 h7" v-if="item.answer_type == 3">共{{item.people_count}}人答题</text>
					
					
				</view>
			</view>
			
		      <empty v-if="!pageData.length"></empty>	
		<!-- 	<view class="list">
				<image :src="$online('img.png')" mode="aspectFill" class="list_top_img"></image>
				<view class="row f-column padding20-24">
					<view class="row a-center">
						<view class="tip flexac xuanStudy">
							<text class="tip_txt">选学</text>
						</view>
						<text class="flex-1 size26 color_33 bold ellipsis">X市监察委员会职责解读解读解</text>
					</view>
					
					<view class="row j-sb a-center">
						<text class="color_66 h7">共100题，每日10题</text>
						<view class="d-flex f-column">
							<text class="color_66 h7 schedule">总进度 40%</text>
							<view class="progor m-top10">
								<view class="schPro" :style="{width:80+'%'}"></view>
							</view>
						</view>
					</view>
					
					
					<text class="color_E6 h7">请在每日24时前完成答题</text>
					
				</view>
			</view> -->
			
			
		
			
		
			
			
			
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex';
	export default {
		data() {
			return {
				list1:[{
					name:'答题中'
				},{
					name:'已完成'
				}],
				itemStyle:{
					height:'70rpx'
				},
				current:0,
				pageData:[],
			}
		},
		onLoad() {
			this.getMyRankingList();
		},
		methods: {
			getMyRankingList(){
				this.$http.post({
					url:'/SRA_Standup2021/getMyRankingList',
					data:{
						state:this.current,
						token: this.bid
					}
				}).then(res=>{
					if(!res.success) return;
					this.pageData = res.data || [];
				})
			},
			Toanswer(item){
				const gid = Object.keys(item.bankArr)[0];
				this.toUrl(`/answer/answer/answer?act_id=${item.sid}&gid=${gid}`)
			},
			click(e){
				this.current = e.index;
				this.getMyRankingList();
			}
		},
		computed:{
			...mapState(['inactiveStyle','activeStyle','color','bid'])
		}
	}
</script>

<style lang="scss" scoped>
	// #ifdef MP-WEIXIN
	.nav{
		width:100%;
		height: 100rpx;
		padding:0 140rpx;
		position: fixed;
		top:0;
		left:0;
		z-index:100;
		background-color: #ffffff;
	}
	// #endif
	// #ifdef H5
	.nav{
		width:100%;
		height: 100rpx;
		padding:0 140rpx;
		position: fixed;
		top:40px;
		left:0;
		z-index:100;
		background-color: #ffffff;
	}
	// #endif
	.list{
		width:100%;
		background-color: #ffffff;
		box-shadow: 0 10rpx 20rpx #e6e6e6;
		border-radius: 10rpx;
		overflow: hidden;
		margin-bottom: 30rpx;
	}
	.list_top_img{
		width:100%;
		height: 200rpx;
	}
	.tip{
		border-radius: 8rpx;
		padding:2rpx 4rpx;
		margin-right: 10rpx;
	}
	.tip_txt{
		color:#ffffff;
		font-size:20rpx;
		zoom:0.9;
	}
	.biStudy{
		background-color: #FFB346;
	}
	.xuanStudy{
		background-color: #43A0FF;
	}
	.progor{
		width: 110rpx;
		height: 10rpx;
		background: #E4E4E4;
		border-radius: 6rpx;
		position: relative;
		overflow: hidden;
	}
	.schPro{
		height: 100%;
		background-color: #FF5255;
		position: absolute;
		top:0;
		left:0;
	}
</style>
